intent

how to find my android application's storing path of apk file

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to make an application that could send itself (apk file) by bluetooth. but i have trouble with finding the apk file path. i tried this code: final PackageManager pm = this.getPackageManager(); List<PackageInfo> packages = pm.getInstalledPackages(PackageManager.GET_META_DATA); String st = null; for (PackageInfo packageInfo : packages) { if(packageInfo.packageName.contains("testbutton")) st=packageInfo.packageName; } Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("image/*"); String uri = "/data/app/";

BroadcastReceiver not working when app is not running

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my manifest file I have declared the receiver. (as follows) <receiver android:name=".OnAlarmReceive" /> however, once I shut down my application, I am not able to get the alarms and the notifications. Apparently, a call to the OnReceive in my Broadcast receiver is never made. public class OnAlarmReceive extends BroadcastReceiver { @Override public void onReceive(Context context, Intent arg1) { //various stuff } } Inside the MainActivity, my alarm manager class is as the follows. AlarmManager alarmManager = (AlarmManager) getSystemService

Intent Filter not calling onReceive for USB_ACCESSORY_ATTACHED

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have declared an intent filter for USB_ACCESSORY_ATTACHED in the constructor of a MyDialogFragment and registered/unregistered it in the fragment's onResume and onPause methods. MyReceiver extends BroadcastReceiver in an inner class to receive the USB_ACCESSORY_ATTACHED intent. See following code: public class MyDialogFragment extends DialogFragment { private Context context; private IntentFilter usbIntentFilter; private MyReceiver myReceiver; MyDialogFragment(Context context) { usbIntentFilter = new IntentFilter(UsbManager.ACTION_USB

SecurityException: Not allowed to start service Intent act=com.google.android.c2dm.intent.REGISTER

匿名 (未验证) 提交于 2019-12-03 02:15:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I get the error SecurityException: Not allowed to start service Intent but looks like it do not have good solution after searching many topics. Please help me, Thanks, p/s : I'm make sure I used correct SENDER_ID as project number was defined at Google API Console and correct package name . Error : Manifest.xml file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.cloudstringers" > <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="

Android: send an email with an image from an ImageView

匿名 (未验证) 提交于 2019-12-03 02:15:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new here on stackoverflow. I have a little problem with my Android app, expecially with an ImageView that triggers an event on tap. This event opens an email client with some pre-written text and it should attach the image of the Image. I already know that the image should be converted into a bitmap before, then compressed and send it to the email client, but unfortunatly I'm not an Android/Java expert so I can't find how to do that. This is the code of the email method: new code below Where I have to replace "String imageURI = null;"

How to open the Google Play Store directly from my Android application?

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have open the google play store using the follwing code Intent i = new Intent(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("https://play.google.com/store/apps/details?id=my packagename ")); startActivity(i);. But it shows me a Complete Action View as to select the option (browser/play store). I need to open the application in playstore directly. 回答1: You can do this using the market:// prefix . final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { startActivity(new Intent

How to monitor SIM state change

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to be able to do some stuff when the SIM state change, i.e. play a sound when SIM PIN is required, but I think there are no Broadcast events that can be intercepted by a broadcast receiver for this... registering for android.intent.action .PHONE_STATE does only tell you when the CALL-STATE changes.. An alternative can be starting a service that registers a PhoneStateListener and reacts upon a LISTEN_SERVICE_STATE (when the state is OUT-OF-STATE it can get the SIM state from the TelephonyManager and look if the state is SIM_STATE_PIN

Android: Start Activity from preferences.xml

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to start an Activity from a default preferences.xml, with < intent > tag. The Activities are well tested, the problem is not with that. (I'm extending PreferenceActivity in my app, so the preferences.xml is "comes" with that) Please look at the code, what's wrong? preferences.xml: .... <PreferenceCategory android:title="@string/titleEtcSetup"> <PreferenceScreen android:key="renameCourses" android:title="@string/titleRenameCourses" android:summary="@string/textRenameDisplayedCoursesNames"> <intent android:action="android.intent

How to Programmatically Enable/Disable Accessibility Service in Android

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I would like to programmatically enable/disable Accessibility Services listed under Settings->Accessibility option. I could start Accessibility Intent like below: Intent intent = new Intent ( android . provider . Settings . ACTION_ACCESSIBILITY_SETTINGS ); startActivityForResult ( intent , 0 ); But I don't have any idea on how to enable the services listed in the view through my code. Please, provide me your views. 回答1: I found a solution worked for me by calling Settings . Secure . putString ( getContentResolver (), Settings .

How do I pass parameters to android Intent in new scheme on chrome?

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a web app calling a native app on android via an iframe intent which does not work in chrome 25 according to the following.... https://developers.google.com/chrome/mobile/docs/intents The intent was structured like the following.... app://Requesttype=Testing&Type=123&tn=0000000000 In the new intent:// scheme how would I go about passing the parameters listed after app:// to the native application? I haven't been able to find an example. 回答1: With the new scheme, you can pass arguments as extras to the App, but you must encode the URI