暗黙のインテントを受け取る

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
アバター
shiro4ao
記事: 224
登録日時: 13年前
住所: 広島

暗黙のインテントを受け取る

#1

投稿記事 by shiro4ao » 11年前

暗黙のインテントを受け取れるアプリを作ろうとしているのですが
サンプルとして下記のようなマニフェストファイルを書いてインストールしたのですが
chromeで共有の一覧の中にアプリケーション(test)が出て来ませんでした
どのように記述すれば暗黙のインテントを受け取れるようになりますか?

コード:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test01"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.test01.test01"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
          <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http"  />
            </intent-filter>
            </activity>
    </application>

</manifest>

ISLe
記事: 2650
登録日時: 13年前
連絡を取る:

Re: 暗黙のインテントを受け取る

#2

投稿記事 by ISLe » 11年前

未検証ですが…

ページの共有には、
android.intent.action.VIEW
じゃなくて
android.intent.action.SEND
なのでは。

アバター
shiro4ao
記事: 224
登録日時: 13年前
住所: 広島

Re: 暗黙のインテントを受け取る

#3

投稿記事 by shiro4ao » 11年前

いつもご回答ありがとうございます。m(_ _)m
android.intent.action.SENDに変更して
android:mimeType="text/*"とテキストで受け取るようにしたら
共有の一覧にでてきました。
ありがとうございました。

コード:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.autodic01"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.autodic01.AutoDic01"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
          <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
                 <data android:mimeType="text/*" />
            </intent-filter>
            </activity>
    </application>

</manifest>


閉鎖

“C言語何でも質問掲示板” へ戻る