intent

android intent for sdcard ready

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an application that uses a file on the SD card, the application runs when the phone boots, and it has become apparent that the file cannot be accessed when the program is first run as it starts working before SD card is avaliable. Is there an broadcast receiver I can use to tell when the SD card is ready? Update Just to summarise the answer to register the intent do: IntentFilter filter = new IntentFilter (Intent.ACTION_MEDIA_MOUNTED); filter.addDataScheme("file"); registerReceiver(this.mSDInfoReceiver, new IntentFilter(filter)); and

Android: How to resolve Google API connection fail from a Service?

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: here is the code provided by the official guide, while this is a snippet causing problems. @Override public void onConnectionFailed(ConnectionResult result) { if (mResolvingError) { // Already attempting to resolve an error. return; } else if (result.hasResolution()) { try { mResolvingError = true; result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR); } catch (IntentSender.SendIntentException e) { // There was an error with the resolution intent. Try again. mGoogleApiClient.connect(); } } else { // Show dialog using

Send message to specific contact through whatsapp from another app

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to send message to a specific contact through whatsapp directly from another app? I know the contact ID. I don't want to open whatsapp via Intent. I just want to send the message directly like normal sms. i have tried other solutions posted on stackoverflow but they are not working for me. 回答1: Let me know if it works for you, Uri mUri = Uri.parse("smsto:+9876543210"); Intent mIntent = new Intent(Intent.ACTION_SENDTO, mUri); mIntent.setPackage("com.whatsapp"); mIntent.putExtra("sms_body", "The text goes here"); mIntent

How to tell which app was selected by Intent.createChooser?

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Code: Intent launchIntent = new Intent ( Intent . ACTION_MAIN ); launchIntent . addCategory ( Intent . CATEGORY_HOME ); Intent chooser = Intent . createChooser ( launchIntent , "Complete Action using.." ); activity . startActivity ( chooser ); I don't see any way to tell which Intent (HOME category launcher) was selected. There is no Inent.addOnActionSetListener, and no chooser.addOnIntentChosenListener etc. So how can I tell which was selected? Do Or do I have to write my own chooser for this? 回答1: On Android 5.1+, you can use the

How to get Context in an Intent Service

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Here's the scenario: I have a WakefulBroadcastReceiver that does a backup to a network computer or the cloud. It's set to go off in the middle of the night, when I know the tablet will have access to the LAN. The backup will store the data to a location and a file that was "picked" by the fragment that instantiated the WakefulBroadcastReceiver, using the Storage Access Framework. So I need to be able to access the ContentResolver and to do that I need the context. From all my reading of the documents, this is what the

how to send MMS without intent programatically

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Uri uri = Uri.parse("file://"+Environment.getExternalStorageDirectory()+"/test.png"); Intent i = new Intent(Intent.ACTION_SEND); i.putExtra("address","1234567890"); i.putExtra("sms_body","This is the text mms"); i.putExtra(Intent.EXTRA_STREAM,"file:/"+uri); i.setType("image/png"); startActivity(i); I want to send MMS but i dont want to use intent object like above because i am developing my own application of sms manager. So how can i send MMS ?? I am referring to this link code but I don't understand it and it doesn't work. 回答1: There is no

No intent from UserRecoverableAuthIOException using Drive SDK for Android

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've implemented google drive into my android application and it work pretty nice, but I'm trying to figure out a way to run an upload/download in a background thread so that I can leave an activity and do something else on my app. The problem is, drive needs the activity reference in case of exceptions, such as UserRecoverableAuthIOException . Here's the issue I cannot understand. Here's some try/catch code: try { //...drive api stuff here } catch (UserRecoverableAuthIOException e) { possibleException = e; try { e.getIntent(); } catch (

Unable to access Internet via WiFi from a Background service

匿名 (未验证) 提交于 2019-12-03 03:02:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'll get straight onto some facts/figures I discovered pls help me if you've faced/solved a similar problem. I send back data every 5 minutes to a server unless the user manually toggles it Off with the help of a wakeful broadcast receiver through a intent service . Plus I get wifi locks before doing (I've tried this already without locks; doesnt work either) Now on devices sending back data from regular data networks (2G/3G/4G) this works fine but on those connected to a wifi network somehow gets me a getActiveNetworkInfo() as null (Even

Google Cloud Messaging (GCM) - unable to instantiate receiver - java.lang.ClassNotFoundException

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: As soon as the app starts or when the push notification is sent from the server, the following traceback happens. 08-31 02:00:14.733: E/AndroidRuntime(30973): java.lang.RuntimeException: Unable to instantiate receiver com.example.smsmining.GcmBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.example.smsmining.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.example.smsmining-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.smsmining-1, /vendor/lib, /system/lib]] 08-31 02:00:14.733: E

Android: permission denied for window type 2038 using TYPE_APPLICATION_OVERLAY

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I trying to create a view that is above other applications: WindowManager.LayoutParams paramsDirectorView = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); I have looked in other responses and found the following things for "drawing over applications": I have android.permission.SYSTEM_ALERT_WINDOW in the manifest I am doing the Settings.canDrawOverlays