Skip to content

Instantly share code, notes, and snippets.

@ThrowJojo
ThrowJojo / Service.kt
Created April 2, 2018 00:18
findViewById Kotlin
val textView = overlay?.findViewById<TextView>(R.id.textView)
@ThrowJojo
ThrowJojo / Service.kt
Created April 2, 2018 00:16
deprecated findViewById
val textView = overlay?.findViewById(R.id.textView) as TextView
@ThrowJojo
ThrowJojo / MainActivity.kt
Created March 23, 2018 02:58
Example MainActivity
package testing.jobdispatcher
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.firebase.jobdispatcher.FirebaseJobDispatcher
import com.firebase.jobdispatcher.GooglePlayDriver
import com.firebase.jobdispatcher.Lifetime
import com.firebase.jobdispatcher.Trigger
class MainActivity : AppCompatActivity() {
@ThrowJojo
ThrowJojo / AndroidManifest.xml
Created March 23, 2018 02:57
Example manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="testing.jobdispatcher">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
@ThrowJojo
ThrowJojo / TaskService.kt
Created March 23, 2018 02:55
TaskService class
package testing.jobdispatcher
import android.util.Log
import com.firebase.jobdispatcher.JobParameters
import com.firebase.jobdispatcher.JobService
class TaskService : JobService() {
override fun onStartJob(job: JobParameters?): Boolean {
Log.e(TaskService::class.java.name, "START JOB")
@ThrowJojo
ThrowJojo / build.gradle
Created March 23, 2018 02:54
FJD dependency
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
@ThrowJojo
ThrowJojo / build.gradle
Created March 16, 2018 00:44
Build gradle script
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
}
}
}
}
@ThrowJojo
ThrowJojo / openURL.js
Created March 9, 2018 00:29
Mailto with subject
Helpers.openURL("mailto:feedback@test.com?subject=Feedback");
@ThrowJojo
ThrowJojo / openURL.js
Created March 9, 2018 00:27
Email intent
Helpers.openURL("mailto:feedback@test.com");
@ThrowJojo
ThrowJojo / Helpers.js
Created March 9, 2018 00:25
Opening a link in React Native
// Opens a link
static async openURL(url: string): Promise<void> {
try {
await Linking.openURL(url);
} catch (error) {
console.log(error);
}
}