This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test"> | |
... | |
<application | |
... | |
<receiver android:name=".sms.SMSReceiver"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SMSReceiver extends BroadcastReceiver { | |
private static final String TAG = "SMSReceiver"; | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
Log.d(TAG, "BroadcastReceiver Received"); | |
if ("android.provider.Telephony.SMS_RECEIVED".equals(intent.getAction())) { | |
Bundle bundle = intent.getExtras(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test"> | |
... | |
<uses-permission android:name="android.permission.READ_SMS"/> | |
<uses-permission android:name="android.permission.RECEIVE_SMS"/> | |
... | |
</manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
// Check which request it is that we're responding to | |
if (requestCode == PICK_CONTACT_REQUEST) { | |
// Make sure the request was successful | |
if (resultCode == RESULT_OK) { | |
// Get the URI that points to the selected contact | |
Uri contactUri = data.getData(); | |
// We only need the NUMBER column, because there will be only one row in the result | |
String[] projection = {Phone.NUMBER}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create intent to deliver some kind of result data | |
Intent result = new Intent("com.example.RESULT_ACTION", Uri.parse("content://result_uri")); | |
setResult(Activity.RESULT_OK, result); | |
finish(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final int PICK_CONTACT_REQUEST = 1; // request code | |
private void pickContact() { | |
Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts")); | |
pickContactIntent.setType(Phone.CONTENT_TYPE); | |
startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap newImage = Bitmap.createBitmap(bitmap).copy(Config.ARGB_8888, true); | |
Canvas canvas = new Canvas(newImage); | |
canvas.drawCircle(100, 100, 50, pnt); | |
canvas.drawBitmap(bitImage, x, y, pnt); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const strDatetime = "2019-06-18T09:21:48Z" | |
const longDatetime = Date.parse(strDatetime) // 1560849708000 | |
const parsedDatetime = new Date(longDatetime).toString() // Tue Jun 18 2019 18:21:48 GMT+0900 (GMT+09:00) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val appUpdateManager = AppUpdateManagerFactory.create(this) | |
appUpdateManager.appUpdateInfo.addOnCompleteListener { | |
val result = it.result | |
if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE | |
&& result.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) { | |
info("should show update") | |
appUpdateManager.startUpdateFlowForResult( | |
result, | |
AppUpdateType.FLEXIBLE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Widget _buildItem(Item item) { | |
return InkWell( | |
child: Container( | |
decoration: BoxDecoration( | |
border: Border.all( | |
color: Colors.green, | |
), | |
borderRadius: BorderRadius.circular(8), | |
), | |
child: Padding( |