Skip to content

Instantly share code, notes, and snippets.

View Ochornma's full-sized avatar
🎯
Looking for new opportunities

Promise Ochornma Ochornma

🎯
Looking for new opportunities
View GitHub Profile
@Ochornma
Ochornma / AndroidManifest.xml
Last active December 26, 2019 17:13
Android manifest for wear os
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:allowBackup="true"
android:icon="@mipmap/nlogo"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
@Ochornma
Ochornma / network_security_config.xml
Last active December 26, 2019 17:13
network security configuration
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">domain name without https://</domain>
</domain-config>
</network-security-config>
@Ochornma
Ochornma / AndroidManifest_Wear.xml
Last active December 26, 2019 17:12
Android manifest essential
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:allowBackup="true"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
@Ochornma
Ochornma / layout.xml
Last active December 26, 2019 17:12
The layout for the radio app
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/uiradio"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:elevation="0dp"
android:layout_width="match_parent"
@Ochornma
Ochornma / RadioService.java
Last active May 8, 2020 06:46
The service for the radio app
public class RadioService extends Service {
private final IBinder binder2 = new RadioLocalBinder();
public SimpleExoPlayer player;
private PlayerNotificationManager playerNotificationManager;
private MediaSessionCompat mediaSession;
private MediaSessionConnector mediaSessionConnector;
private Context context;
private boolean check;
@Ochornma
Ochornma / wear_layout.xml
Last active December 26, 2019 17:10
Attribute for wear os layouts
app:boxedEdges="all"
@Ochornma
Ochornma / MainActivity.java
Last active December 26, 2019 17:56
The radio main activity
public class MainActivity extends AppCompatActivity {
public static final String PREFRENCES = "com.dclm.radio";
public Boolean isOnline;
private Intent intent;
RadioService radioService;
boolean mBound = false;
private ImageButton buttonPlay, buttonPause;
private Button buttonLive
@Ochornma
Ochornma / MainActivityWear.java
Created December 27, 2019 11:10
Checking for speaker support on WearOS.
PackageManager packageManager = getPackageManager();
// The results from AudioManager.getDevices can't be trusted unless the device
// advertises FEATURE_AUDIO_OUTPUT.
if (!packageManager.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT)) {
return false;
}
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
for (AudioDeviceInfo device : devices) {
if (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) {
Caused by: java.lang.IllegalStateException: Migration didn't properly handle: note_table(org.dclm.live.ui.sermon.Note).
Expected:
TableInfo{name='note_table', columns={point3=Column{name='point3', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='null'}, point2_description=Column{name='point2_description', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='null'}, point3_description=Column{name='point3_description', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='null'}, point1=Column{name='point1', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='null'}, date=Column{name='date', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='null'}, point4=Column{name='point4', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='null'}, service=Column{name='service', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='
database.execSQL("CREATE TABLE IF NOT EXISTS note_table_Tmp (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service TEXT NULL, date TEXT , speaker TEXT, topic TEXT, description TEXT, point1 TEXT, point1_description TEXT, point2 TEXT, point2_description TEXT, point3 TEXT, point3_description TEXT, point4 TEXT, point4_description TEXT, decision TEXT)")
database.execSQL("INSERT INTO note_table_tmp(id, service, date , speaker, topic, description, point1, point1_description , point2 , point2_description , point3 , point3_description , point4 , point4_description , decision) SELECT id, service, date , speaker, topic, description, point1, point1_description , point2 , point2_description , point3 , point3_description , point4 , point4_description , decision FROM note_table")
database.execSQL("DROP TABLE note_table")
database.execSQL("ALTER TABLE note_table_Tmp RENAME TO note_table")