android-intent

Start Activity from a Broadcast Receiver

僤鯓⒐⒋嵵緔 提交于 2020-01-02 16:17:58
问题 I've got the following scenario for Android: I have an app that when launched starts a service . That service checks a url every 30 minutes. If it gets a specific response, it sends a Broadcast which the app receives and processes. That scenario is working great for me. I'd also like my service to continue running after the user has stopped running the application (app out of foreground.) Which I've got working as well. The problem that I'm facing is that when the Activity receives the

Hide NFC app from “Choose Application” list / Disable start by external NFC intent

折月煮酒 提交于 2020-01-02 15:26:24
问题 I'm currently writing a couple of NFC enabled apps for Android and wanted to know how I can stop my application from being in the "choose application" list that's opened whenever a tag is scanned from the launcher or a non-NFC app. I only want my apps to be able to read the tags when they are open. My current intent filters: <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action

Send Email With only Email client application in android

寵の児 提交于 2020-01-02 15:08:45
问题 I want to implement an option to send email. Right now i can send email but problem is, Android shows many applications to send such as bluetooth, facebook, message,etc which is not required. I need to avoid this and show only email client application. Intent intent = new Intent(Intent.ACTION_SEND); String[] emails = {"suresh.chandani@gmail.com"}; intent.putExtra(Intent.EXTRA_EMAIL, emails); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.putExtra(Intent.EXTRA_SUBJECT, "Test App"); intent

Android Google Maps API v2 start navigation

白昼怎懂夜的黑 提交于 2020-01-02 15:02:47
问题 I have an app that displays a map with a marker. When the user touches the marker I want to start navigation for them. Is there an Intent/Activity that I can pass a longitude and latitude and start theusers navigation app? Thanks for any help. 回答1: I solved it like this. The url posted is similar. Intent navigation = new Intent( Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=START_LAT,START_LON&daddr=END_LAT,END_LON")); startActivity(navigation); Where Start is the START_LON

Android: startActivity() from AlertDialog

眉间皱痕 提交于 2020-01-02 14:50:34
问题 I am trying to use a Button in an AlertDialog to view a webpage. The problem is that this AlertDialog is located inside a class that extends ItemizedOverlay and doesn't extend Activity, so Eclipse underlines it and gives the following error: The method startActivity() is undefined for the type new DialogInterface.OnClickListener(){} I would like to launch activities from the PositiveButton, NeutralButton and NegativeButton, but I am not able to. In case you need more context, the main

NFC card emulation with closed reader application

给你一囗甜甜゛ 提交于 2020-01-02 14:39:53
问题 I have two apps on two Android devices, similar to CardEmulation and CardReader from the samples for NFC. I want to send data from the host card emulation app running on one Android device to the reader application running on the second Android device. This works when both apps are open in foreground. But if I close the reader application, I can no longer send data to it. Instead, when the two phones are held together, they activate Beam transmission. However, I would like to have the reader

Inter Application Communication in Android

僤鯓⒐⒋嵵緔 提交于 2020-01-02 10:28:28
问题 I have an activity in one application that calls the activity of another application. How can be done with intent or any other way. For example in single application, we can do it like: Intent i = new Intent(this, ActivityTwo.class); i.putExtra("Value1", "This value is sent by FirstActivity "); 回答1: Declare android action for the Second Activity and call the Second Activity from First Activity through the Action name. For more info see the below example: Declared Second Activity in

Receive broadcasts in stopped application

可紊 提交于 2020-01-02 08:22:51
问题 By default, an application which in stopped state (not yet run even once) could not receive broadcasts . There is a way to receive it if we add the flag FLAG_INCLUDE_STOPPED_PACKAGES to the broadcast intent. My problem is that I need to receive system intent android.intent.action.MEDIA_MOUNTED (and I don't want to add that flag to it). How can I receive it even in stopped application? It seems to me that for sure it's possible because for example com.android.shell application is able to

Android - Create shortcut from adb

余生长醉 提交于 2020-01-02 08:10:30
问题 I want to create a shortcut via adb for an application I'm developing. I have looked in Grepcode to see how the intent Android is expecting to be formatted. I also checked the AM documentation to try to create the intent required. So far I got a lot of variations of the line below, but this one seems the most appropriate. adb -d shell am broadcast \ -a com.android.launcher.action.INSTALL_SHORTCUT \ --es Intent.EXTRA_SHORTCUT_NAME "<shortcut-name>" \ --esn Intent.EXTRA_SHORTCUT_ICON_RESOURCE \

How to intent SharedPreferences into next activity value using PostResponseAsyncTask in Android Studio?

梦想的初衷 提交于 2020-01-02 07:29:15
问题 my question is the extension of this question here but in this question I added two function which are : SharedPreferences Remember me function (Checkbox) Currently, I managed to login with/without remember me checkbox and intent the rest of the JSON Object fetch from mysql database. But the problem is inside LoginActivity.java PART A block . When I restart/rebuild the apps, the intent data is null which is not stored and sent into next activity. The data could not be stored and sent into