
카톡링크 를 이용하여 메세지 보내는 것을 연습중인데요...
인터넷에 나온대로 했는데...
저런식으로 오류가 나와서 빌드가 안되고 있습니다.
예제와 다른점: 한가지 다른점은 첫번째 임포트에서 link가 두번 들어가 있습니다..
import com.kakao.kakaolink.KakaoLink;
import com.kakao.kakaolink.KakaoTalkLinkMessageBuilder;
import com.kakao.util.KakaoParameterException;
소스는 다음과 같습니다...
참고사이트는 https://ringsterz.wordpress.com/2014/12/10/kakaolink%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%98%EC%97%AC-%EC%95%B1%EC%97%90%EC%84%9C-%EC%B9%B4%EC%B9%B4%EC%98%A4%ED%86%A1-%ED%86%B5%ED%95%B4-%EB%A9%94%EC%8B%9C%EC%A7%80-%EC%A0%84%EC%86%A1%ED%95%98/
public class kakaoActivity extends AppCompatActivity {
//private SessionCallback callback; //콜백 선언
private KakaoLink kakaoLink;
private KakaoTalkLinkMessageBuilder kakaoTalkLinkMessageBuilder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//callback = new SessionCallback(); // 이 두개의 함수 중요함
//Session.getCurrentSession().addCallback(callback);
setContentView(R.layout.activity_kakao);
try {
kakaoLink = KakaoLink.getKakaoLink(getApplicationContext());
kakaoTalkLinkMessageBuilder = kakaoLink.createKakaoTalkLinkMessageBuilder();
kakaoTalkLinkMessageBuilder.addText("test");
kakaoLink.sendMessage(kakaoTalkLinkMessageBuilder.build(), this);
kakaoTalkLinkMessageBuilder = kakaoLink.createKakaoTalkLinkMessageBuilder();
} catch (KakaoParameterException e) {
Log.e("error",e.getMessage());
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="~~~~~~~~~">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".GlobalApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar">
<activity android:name=".IntroActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".firstActivity"></activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".mapActivity"
android:label="@string/title_activity_map" />
<activity android:name=".kakaoActivity">
<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:host="@string/kakaolink_host"
android:scheme="@string/kakao_scheme" />
</intent-filter>
</activity>
<activity android:name=".KakaoSignupActivity" />
<activity android:name=".talkActivity">
</activity>
<meta-data
android:name="com.kakao.sdk.AppKey"
android:value="@string/kakao_app_key" />
</application>
</manifest>